
<%-- 
    Document   : newjsp
    Created on : Jun 17, 2011, 3:41:07 PM
    Author     : Hany
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%@page import="javax.servlet.*,javax.servlet.http.*,java.io.*,java.sql.*"%>

<%
      String u_name = request.getParameter("user_name").toString();
      String pwd = request.getParameter("pass_word").toString();
    
    
    Class.forName("com.mysql.jdbc.Driver");
    String url = "jdbc:mysql://127.0.0.1/rentacar";
    Connection con=DriverManager.getConnection(url,"root","root");
    Statement st=con.createStatement();
    
     String query="Select * from user_data where username='"+u_name+"' AND password ='"+pwd+"';";
   
     ResultSet rs = st.executeQuery( query );
   
     if(rs.next())
     {
         out.println(request.getParameter("user_name"));
         out.println(request.getParameter("pass_word"));
            out.println("Successful");
	  
     }
     else
     {
     
         out.println("UNSuccessful");
         
     }
     
   

  }
%>

    </body>
</html>
